package com.xsh.opensltest;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.xsh.opensltest.test.InstrumentTest;

import java.io.File;
// 重构名称到AllOpenSlInsActivity
public class OpenSlInstrumentTest extends AppCompatActivity {

    private LinearLayout slPluginsTestList;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_open_sl_instrument_test);
        slPluginsTestList = findViewById(R.id.slPluginsTestList);
        for(File f:App.appFilesDir.listFiles())
        {
            // 排除报错日志目录
            if(!f.getName().equals("tombstones"))
            {
                Button a = new Button(OpenSlInstrumentTest.this);
                a.setText(f.getName());
                a.setOnClickListener(new View.OnClickListener()
                {
                    @Override
                    public void onClick(View view)
                    {
                        Intent intent = new Intent(OpenSlInstrumentTest.this, InstrumentTest.class);
                        intent.putExtra("instrument_name",f.getName());
                        startActivity(intent);
                    }
                });
                slPluginsTestList.addView(a);
            }
        }
    }
}